﻿south_africa_unite_saf = {
	is_shown = {
		OR = {
			country_has_primary_culture = cu:boer
			country_has_primary_culture = cu:voortrekker
            country_has_primary_culture = cu:xhosa
            country_has_primary_culture = cu:zulu
            country_has_primary_culture = cu:sotho
			country_has_primary_culture = cu:griqua
		}
		is_subject = yes
		any_neighbouring_state = {
			owner = {
				OR = {
					country_has_primary_culture = cu:boer
					country_has_primary_culture = cu:voortrekker
                    country_has_primary_culture = cu:xhosa
                    country_has_primary_culture = cu:zulu
                    country_has_primary_culture = cu:sotho
					country_has_primary_culture = cu:griqua
				}
				is_ai = yes
				is_subject = yes
				NOT = { THIS = ROOT }
				top_overlord = {
					THIS = root.top_overlord
				}
			}
		}
	}

	possible = {
		is_at_war = no
		has_technology_researched = nationalism
		top_overlord = {
			relations:root >= relations_threshold:amicable
		}
		NOT = { has_modifier = south_africa_recent_unification }
		custom_tooltip = {
			text = unite_south_africa_je_saf_tt
			any_neighbouring_state = {
				owner = {
					relations:root >= relations_threshold:amicable
					OR = {
						country_has_primary_culture = cu:boer
						country_has_primary_culture = cu:voortrekker
                        country_has_primary_culture = cu:xhosa
                        country_has_primary_culture = cu:zulu
                        country_has_primary_culture = cu:sotho
						country_has_primary_culture = cu:griqua
					}
					is_ai = yes
					is_subject = yes
					NOT = { THIS = ROOT }
					top_overlord = {
						THIS = root.top_overlord
					}
					this.gdp < root.gdp
				}
			}
		}
	}
	when_taken = {
		custom_tooltip = unite_south_africa_tt
		hidden_effect = {
			trigger_event = { id = decision_africa.1 popup = yes }
		}
		add_modifier = {
			name = south_africa_recent_unification
			months = short_modifier_time
		}
	}

	ai_chance = {
		base = 100
	}
}

south_africa_unite_gbr = {
	is_shown = {
		any_subject_or_below = {
			OR = {
				country_has_primary_culture = cu:boer
                country_has_primary_culture = cu:voortrekker
                country_has_primary_culture = cu:xhosa
                country_has_primary_culture = cu:zulu
                country_has_primary_culture = cu:sotho
				country_has_primary_culture = cu:griqua
			}
			count >= 2
		}
	}
	possible = {
		is_at_war = no
		has_technology_researched = nationalism
		NOT = { has_modifier = south_africa_recent_unification }
		custom_tooltip = {
			text = gbr_saf_relations_tt
			any_subject_or_below = {
				OR = {
					country_has_primary_culture = cu:boer
					country_has_primary_culture = cu:voortrekker
                    country_has_primary_culture = cu:xhosa
                    country_has_primary_culture = cu:zulu
                    country_has_primary_culture = cu:sotho
					country_has_primary_culture = cu:griqua
				}
				relations:root >= relations_threshold:amicable
				count >= 2
			}
		}
	}
	when_taken = {
		custom_tooltip = unite_south_africa_tt
		hidden_effect = {
			trigger_event = { id = decision_africa.2 popup = yes }
		}
		add_modifier = {
			name = south_africa_recent_unification
			months = short_modifier_time
		}
	}

	ai_chance = {
		base = 100
	}
}

south_africa_unite_force_saf = {
	is_shown = {
		OR = {
			AND = {
				exists = c:SAF
				THIS = c:SAF
			}

			AND = {
				exists = c:BOE
				THIS = c:BOE
			}
		}
		is_subject = yes
		top_overlord = {
			is_ai = yes
		}
		any_neighbouring_state = {
			owner = {
				OR = {
					country_has_primary_culture = cu:boer
				}
				is_subject = no
				NOT = { THIS = ROOT }
			}
		}
	}

	possible = {
		is_at_war = no
		top_overlord = {
			is_at_war = no
		}
		has_technology_researched = nationalism
		top_overlord = {
			relations:root >= relations_threshold:amicable
		}
		NOT = { has_modifier = south_africa_recent_unification_war }

		any_neighbouring_state = {
			owner = {
				custom_tooltip = {
					text = unite_south_africa_force_je_saf_tt
					relations:root < relations_threshold:poor
				}
				
				OR = {
					country_has_primary_culture = cu:boer
				}
				is_subject = no
				NOT = { THIS = ROOT }
			}
		}
	}
	when_taken = {
		custom_tooltip = unite_south_africa_force_tt
		hidden_effect = {
			trigger_event = { id = decision_africa.7 popup = yes }
		}
		add_modifier = {
			name = south_africa_recent_unification_war
			months = normal_modifier_time
		}
	}

	ai_chance = {
		base = 100
	}
}